@@ -110,6 +110,8 @@ WUNDERLIST_OAUTH_SECRET= |
||
110 | 110 |
|
111 | 111 |
EVERNOTE_OAUTH_KEY= |
112 | 112 |
EVERNOTE_OAUTH_SECRET= |
113 |
+# Set to true in development, false in production |
|
114 |
+USE_EVERNOTE_SANDBOX=true |
|
113 | 115 |
|
114 | 116 |
############################# |
115 | 117 |
# AWS and Mechanical Turk # |
@@ -16,13 +16,16 @@ module EvernoteConcern |
||
16 | 16 |
token: evernote_oauth_token, |
17 | 17 |
consumer_key: evernote_consumer_key, |
18 | 18 |
consumer_secret: evernote_consumer_secret, |
19 |
- # set to false in production |
|
20 |
- sandbox: true |
|
19 |
+ sandbox: use_sandbox? |
|
21 | 20 |
) |
22 | 21 |
end |
23 | 22 |
|
24 | 23 |
private |
25 | 24 |
|
25 |
+ def use_sandbox? |
|
26 |
+ ENV["USE_EVERNOTE_SANDBOX"] == "true" |
|
27 |
+ end |
|
28 |
+ |
|
26 | 29 |
def validate_evernote_options |
27 | 30 |
unless evernote_consumer_key.present? && |
28 | 31 |
evernote_consumer_secret.present? && |
@@ -266,11 +266,12 @@ Devise.setup do |config| |
||
266 | 266 |
if defined?(OmniAuth::Strategies::Evernote) && |
267 | 267 |
(key = ENV["EVERNOTE_OAUTH_KEY"]).present? && |
268 | 268 |
(secret = ENV["EVERNOTE_OAUTH_SECRET"]).present? |
269 |
- # for development: |
|
270 |
- config.omniauth :evernote, key, secret, client_options: { :site => 'https://sandbox.evernote.com' } |
|
271 |
- |
|
272 |
- # for production: |
|
273 |
- # config.omniauth :evernote, key, secret |
|
269 |
+ |
|
270 |
+ if ENV["USE_EVERNOTE_SANDBOX"] == "true" |
|
271 |
+ config.omniauth :evernote, key, secret, client_options: { :site => 'https://sandbox.evernote.com' } |
|
272 |
+ else |
|
273 |
+ config.omniauth :evernote, key, secret |
|
274 |
+ end |
|
274 | 275 |
end |
275 | 276 |
|
276 | 277 |
# ==> Warden configuration |